#!/usr/bin/python3
# -*- encoding: utf-8 -*-
'''
@File        :test3.py
@Time        :2020/08/26 19:51:20
@Author      :hejiang
@Software    :vsCode
'''

import requests
from lxml import etree
import time
import random


def check_ip(proxy_str):
    url = "http://www.baidu.com"
    proxy = {"http": proxy_str, "https": proxy_str}
    try:
        response = requests.get(url, timeout=5, proxies=proxy)
        print("可以使用的代理IP：{}".format(proxy_str))
        return True
    except:
        print("破烂IP，服务器辣鸡：{}".format(proxy_str))
        return False


usable_ip_list = [
    'http://190.12.6.138:8080', 'http://67.219.147.11:5836',
    'http://143.137.204.5:80', 'http://83.171.98.129:44380',
    'http://179.125.39.230:52203', 'http://191.7.193.253:35505',
    'http://186.219.96.47:54570', 'http://165.225.204.84:10605',
    'http://165.225.72.86:10605', 'http://165.225.226.100:10605',
    'http://58.220.95.34:10174', 'http://165.225.26.12:10605',
    'http://165.225.94.106:10605', 'http://165.225.226.119:10605',
    'http://104.129.205.46:10605', 'http://165.225.216.77:10605',
    'http://165.225.20.119:10605', 'http://165.225.210.83:10605',
    'http://165.225.77.129:10605', 'http://179.124.242.34:41886',
    'http://197.231.186.148:45578', 'http://165.225.20.122:10605',
    'http://165.225.218.100:10605', 'http://58.220.95.40:10174',
    'http://183.195.106.118:8118', 'http://165.227.35.11:80',
    'http://61.135.155.82:443', 'http://165.225.104.64:10605',
    'http://165.225.56.80:10605', 'http://165.225.36.176:10605',
    'http://183.88.228.208:8080', 'http://131.161.68.41:31264',
    'http://103.99.8.106:84', 'http://60.205.132.71:80',
    'http://84.22.48.81:8080', 'http://58.220.95.86:9401',
    'http://51.89.4.140:8118', 'http://49.231.159.165:8080',
    'http://150.66.1.137:80', 'http://170.233.164.192:8080',
    'http://31.135.93.56:45938', 'http://171.13.4.100:9999',
    'http://183.220.145.3:80'
]

for proxy_str in usable_ip_list:
    check_ip(proxy_str)
